package echecs.ia;

import javax.swing.JApplet;

public class AEvaluationA extends AlphaBeta {

    public AEvaluationA(JApplet ref) {
        super(ref);

    }

    public float evaluation() {
        float valeur = 0;
        float figur = 0;
        for (int i = 21; i < 99; i++) {
            if (board[i] != 0) {
                //material
                switch (board[i] % 10) {
                    case 1:
                        figur = 1.0F;
                        break;
                    case 2:
                    case 3:
                        figur = 3.0F;
                        break;
                    case 4:
                        figur = 4.5F;
                        break;
                    case 5:
                        figur = 9.0F;
                        break;
                    case 6:
                        figur = 0.0F;
                }
                //position
                figur += posvalues[i];
                if (board[i] % 100 / 10 == color) {
                    valeur += figur;
                } else {
                    valeur -= figur;
                }
            }
            if (i % 10 == 8) {
                i += 2;
            }
        }
        return valeur;
    }
}
